<template>
  <div class="result-page">
    <!-- 成功图标 -->
    <div class="success-section">
      <img src="@/assets/success.png" alt="成功" class="success-icon">
      <div class="success-title">预录信息提交成功</div>
    </div>

    <!-- 学生信息卡片 -->
    <div class="info-card">
      <!-- <div class="card-header">学生信息</div> -->
      <div class="info-content">
        <div class="info-row">
          <span class="label">学生姓名：</span>
          <span class="value">{{ resultData.studentName || '--' }}</span>
        </div>
        <div class="info-row">
          <span class="label">学生编号</span>
          <span class="value">{{ resultData.studentCode || '--' }}</span>
        </div>
        <div class="info-row">
          <span class="label">学生性别：</span>
          <span class="value">{{ resultData.studentSex === 0 ? '男' : resultData.studentSex === 1 ? '女' : '--' }}</span>
        </div>
        <div class="info-row">
          <span class="label">出生日期：</span>
          <span class="value">{{ resultData.studentBirthday || '--' }}</span>
        </div>
        <div class="info-row">
          <span class="label">联系电话：</span>
          <span class="value">{{ resultData.studentMobile || '--' }}</span>
        </div>
        <div class="info-row">
          <span class="label">所在学校：</span>
          <span class="value">{{ resultData.atSchool || '--' }}</span>
        </div>
        <div class="info-row">
          <span class="label">家长姓名：</span>
          <span class="value">{{ resultData.parentName || '--' }}</span>
        </div>
        <div class="info-row">
          <span class="label">家庭住址：</span>
          <span class="value">{{ resultData.studentAddress || '--' }}</span>
        </div>

        <div class="info-row">
          <span class="label">提交时间：</span>
          <span class="value">{{ resultData.createTime || '--' }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'StudentPreRegisterResult',
  data() {
    return {
      resultData: {}
    }
  },
  created() {
    // 从路由参数中获取结果数据
    if (this.$route.params.resultData) {
      this.resultData = this.$route.params.resultData;
    } else {
      // 如果没有数据，显示默认信息
      this.resultData = {
        studentName: '--',
        studentSex: null,
        studentBirthday: '--',
        studentMobile: '--',
        atSchool: '--',
        parentName: '--',
        studentAddress: '--',
        studentCode: '--',
        createTime: '--'
      };
    }
  }
}
</script>

<style lang="scss" scoped>
.result-page {
  min-height: 100vh;
  background: #f5f5f5;
  padding: 20px;
  box-sizing: border-box;
}

.success-section {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px 0;

  .success-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
  }

  .success-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
  }
}

.info-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);

  .card-header {
    background: #f8f9fa;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
  }

  .info-content {
    padding: 0 20px;
  }

  .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;

    &:last-child {
      border-bottom: none;
    }

    .label {
      font-size: 14px;
      color: #666;
      flex-shrink: 0;
    }

    .value {
      font-size: 14px;
      color: #333;
      font-weight: 500;
      text-align: right;
      flex: 1;
      margin-left: 10px;
    }
  }
}
</style>
